<?php
/**
 * Created by PhpStorm.
 * User: xuechunxuan
 * Date: 2018/10/18
 * Time: 11:17
 */
namespace app\index\controller;

use think\Request;

class Share extends Session {
    public function getShare(){
     return new \app\index\model\Share();
    }

    /*
     * 分享明细
     * */
    public function shareDetail(Request $request){
        $page = $request->param("page") ? $request->param("page") : 0;
        $shareDetail=  $this->getShare()->mySelectByKVPage(['openid' => $this->userInfo['openid']], $page, 10);
        if($request->isGet()){
            $this->assign("shareDetail",$shareDetail);
            return $this->fetch();
        }else if($request->isPost()){
            $i=0;
            foreach ($shareDetail as $key){
                $shareDetail[$i]['add_time']=date($shareDetail[$i]['add_time'],"Y-m-d H:i:s");
                $i++;
            }
           return json($shareDetail,200);
        }
    }
}